;;; $DOOMDIR/config.el -*- lexical-binding: t; -*-

;; Place your private configuration here! Remember, you do not need to run 'doom
;; sync' after modifying this file!
;;

;; I am getting this error in the console a lot.  I need to disable centaur-tabs-line in the console, or try to fix it.
;;QuitError during redisplay: (eval (centaur-tabs-line)) signaled (wrong-type-argument stringp (Git "~/prog/gnu/guix/guix-config/linode-guix-system-configuration/"))
;;
(setq-hook! company-mode-hook company-minimum-prefix-length 3)

(setq auth-sources '("~/.authinfo.gpg" "~/.authinfo"))

;; prefer utf-8
(setq locale-coding-system 'utf-8)
(set-terminal-coding-system 'utf-8)
(set-keyboard-coding-system 'utf-8)
(set-selection-coding-system 'utf-8)
(prefer-coding-system 'utf-8)
(when (display-graphic-p)
    (setq x-select-request-type '(UTF8_STRING COMPOUND_TEXT TEXT STRING)))

;; Some functionality uses this to identify you, e.g. GPG configuration, email
;; clients, file templates and snippets.
(setq user-full-name "Joshua Branson"
      user-mail-address "jbranso@dismail.de")

;; the menu bar is helpful.  I don't always remember the options.
(menu-bar-mode 1)

;; There are two ways to load a theme. Both assume the theme is installed and
;; available. You can either set `doom-theme' or manually load a theme with the
;; `load-theme' function. This is the default:
;;(setq doom-theme 'doom-one)
(setq doom-theme 'doom-zenburn)

;; Doom exposes five (optional) variables for controlling fonts in Doom. Here
;; are the three important ones:
;;
;; + `doom-font'
;; + `doom-variable-pitch-font'
;; + `doom-big-font' -- used for `doom-big-font-mode'; use this for
;;   presentations or streaming.
;;
;; They all accept either a font-spec, font string ("Input Mono-12"), or xlfd
;; font string. You generally only need these two:
;; (setq doom-font (font-spec :family "monospace" :size 12 :weight 'semi-light)
;;       doom-variable-pitch-font (font-spec :family "sans" :size 13))
;;(setq doom-font (font-spec :family "Hack" :size 14))

(after! gnus
  (evil-set-initial-state 'gnus-group-mode 'emacs)
  (evil-set-initial-state 'gnus-article-mode 'emacs)
  (evil-set-initial-state 'gnus-summary-mode 'emacs))

(after! debbugs
  (evil-set-initial-state 'debbugs-gnu-mode 'emacs)
  (evil-set-initial-state 'woman-mode 'emacs)
  (evil-set-initial-state 'info-mode 'emacs))

(after! magit
  (evil-set-initial-state 'git-rebase-mode 'emacs))

;; I need to use imap to read my dismail inbox...for some reason, my local gnus
;; cannot read my local dovecot Inbox...No idea why.
(setq gnus-select-method '(nnimap "imap.dismail.de"))

(setq gnus-secondary-select-methods
      '(
        ;; I would like to use gnus as my maildir, but imap works just fine for now.
        ;; (nnmaildir "dismail.de"
        ;;            (nnir-search-engine notmuch)
        ;;            (nnir-notmuch-additional-switches "search")
        ;;            (directory "~/.mail/dismail/"))
        ;; (nnmaildir "fastmail" (directory "~/.mail/"))
        ;; (nntp "news.gwene.org")
        (nntp "news.gmane.io")
        ;; this makes gnus startup super slow!!! (nnmaildir
        ;; "dismail.de" (directory "~/.mail/dismail.de/"))

        (nnimap "gnucode.me"
                (nnimap-stream ssl)
                (nnimap-address "imap.gnucode.me")
                (nnimap-user "joshua"))

        ;; this is the right config, but I'm not certain how to set up a dovecot username and password
        (nnimap "localDismail"
                (nnimap-address "localhost")
                (nnimap-stream network)
                (nnimap-server-port 143)
                )))

;; The below bit of code is supposed to be the "best" way to make Gnus archive email into
;; the email Sent folder.  But it does not seem to work.
;; This should help:  https://lists.gnu.org/archive/html/info-gnus-english/2016-03/msg00004.html
;; (setq gnus-message-archive-method "archive"
;;       gnus-message-archive-group "Sent"
;;       ;; ALWAYS SET THIS NEXT LINE.  Otherwise, gnus might not use the current
;;       ;; value of archive-method
;;       gnus-update-message-archive-method 't)

;; save email replies to my Sent folder
(setq gnus-posting-styles
      `((".*"
         (gcc "\"nnimap+imap.dismail.de:Sent\"")
         ;; I use this next line for my dismail filter to mark as read archived messages
         ;; that gnus sends to my Sent folder.
         ("X-Gnus-Sucks" "I know man")
       )))

;; use msmtp
;; from the emacs wiki: https://www.emacswiki.org/emacs/GnusMSMTP
;; send mail function so "C" (mark the bug as done) and "R" in the debbugs-gnu-mode works
(setq message-send-mail-function 'message-send-mail-with-sendmail)
;; we substitute sendmail with msmtp
(setq sendmail-program "/home/joshua/.guix-profile/bin/msmtp")
;; This is needed to allow msmtp to do its magic:
(setq message-sendmail-f-is-evil 't)
;;need to tell msmtp which account we're using
(setq message-sendmail-extra-arguments '("--read-envelope-from"))
;; TODO check that ~/.doom.d/custom.el DOES not have:
;; (send-mail-function 'mailclient-send-it)  that will cause issues when I try
;; to send control messages with debbugs.
(setq send-mail-function 'message-send-mail-with-sendmail)

(after! geiser
  (evil-set-initial-state 'geiser-repl-mode 'emacs))

;; setting up my guix development environment
(add-hook 'geiser-repl-mode-hook 'visual-line-mode)
(setq geiser-repl-per-project-p t)
(with-eval-after-load 'geiser-guile
  (add-to-list 'geiser-guile-load-path "~/prog/gnu/guix/guix-src")
  (add-to-list 'geiser-guile-load-path "~/prog/gnu/guix/guixrus")
  (add-to-list 'geiser-guile-load-path "~/prog/gnu/guix/guix-config")
  (add-to-list 'geiser-guile-load-path "~/prog/gnu/guix/guix-config/linode-guix-system-configuration"))

(map!
   :map scheme-mode-map
   :localleader
   (:desc "jump to symbol at point"
          "j" #'geiser-edit-symbol-at-point)
   (:desc "jump to sybmol I type"
          "J" #'geiser-edit-symbol))

;; this below is NOT working.  I cannot use the scheme-mode snippets.
(with-eval-after-load 'yasnippet
  (add-to-list 'yas-snippet-dirs "~/prog/gnu/guix/guix-src"))

;; I would also like TAB in company mode to select that option.
;; and C-n and C-p to go to the previous option

(load-file "~/prog/gnu/guix/guix-src/etc/copyright.el")

(setq copyright-names-regexp
      (format "%s <%s>" user-full-name user-mail-address))
(add-hook 'after-save-hook 'copyright-update)

;; the below doesn't seem to work for debbugs-gnu-search, because it doesn't.
;; with other debbugs function it does work.
(setq debbugs-gnu-default-packages '("guix" "guix-patches"))

; vertigo is giving me odd issues when I use debbugs-gnu-bugs directly.
(defun debbugs-get-bug-by-id ()
  (interactive)
  (debbugs-gnu-bugs (read-number "What is the bug number: ")))

(defun debbugs-gnu-copy-debbugs-url ()
  "Add to the kill ring the URL of the Debbugs issue at point."
  (interactive)
  (let ((url1 (concat "https://bugs.gnu.org"
		      (number-to-string (debbugs-gnu-current-id))))
	(url2 (concat "https://issues.guix.gnu.org"
		      (number-to-string (debbugs-gnu-current-id)))))
    (kill-new url1)
    (kill-new url2)
    (message "Copied %s and %s" url1 url2)))

(defmacro defun-bug->url (name url &optional docstring)
  "Macro returning yankage #bug URL.

The `interactive' function that the macro returns is then referred by NAME.

Please provide a DOCSTRING."
  (let ((fun (intern (symbol-name name)))
        (doc (concat docstring "\n\n"
                           (format "Yankable result: `%sNUMBER'." url))))
    `(defun ,fun (number)
       ,doc
        (interactive
         (list
          (progn
            (when (not (boundp 'debbugs-gnu-bug-number))
              (setq debbugs-gnu-bug-number -2))
            (read-string
             (format "Bug number (%s): " debbugs-gnu-bug-number)
             nil nil debbugs-gnu-bug-number))))
      (let ((str (format "%s%s" ,url number)))
        (kill-new str)
        (when current-prefix-arg
          (browse-url str))
        (message (format "%s killed." str))))))

(defun-bug->url my/guix-issues "http://issues.guix.gnu.org/issue/"
          "Add URL of bug NUMBER to `kill-ring'.")
(defun-bug->url my/guix-debbugs "https://debbugs.gnu.org/cgi/bugreport.cgi?bug="
          "Add (old) URL of bug NUMBER to `kill-ring'.")

(defun my/guix-data (package)
  "Add URL of PACKAGE to `kill-ring'.

Yankable result:
`https://data.guix.gnu.org/repository/1/branch/master/package/PACKAGE/output-history'.

With `universal-argument', load URL using `browse-url'."
  (interactive "sPackage: ")
  (let ((url
         (format
          "https://data.guix.gnu.org/repository/1/branch/master/package/%s/output-history" package)))
    (kill-new url)
    (when current-prefix-arg
      (browse-url url))
    (message (format "%s killed." url))))

;; add in a hook for debbugs, after you search for bugs, run the command,
;; debbugs-gnu-toggle-suppress (bound to x).  Then will hide closed bug reports.

;; TODO make it so that you can press x by default
;; aka hide all of the closed bugs. The below line doesn't work
;;(add-hook 'debbugs-gnu-mode 'debbugs-gnu-toggle-suppress)

;; the highlight line in the console make it hard to read the text.
;;(remove-hook 'doom-first-buffer-hook 'global-hl-line-mode)

(global-set-key (kbd "C-c t") #'transpose-chars)
(global-set-key (kbd "C-c T") #'transpose-words)

(defun delete-this-file-and-buffer ()
  "Kill the current buffer and deletes the file it is visiting."
  (interactive)
  (let ((filename (buffer-file-name)))
    (when filename
      (if (vc-backend filename)
          (vc-delete-file filename)
        (progn
          (delete-file filename)
          (message "Deleted file %s" filename)
          (kill-buffer))))))

(defun rename-this-file-and-buffer ()
  "Rename the current buffer and file it is visiting."
  (interactive)
  (let ((filename (buffer-file-name)))
    (if (not (and filename (file-exists-p filename)))
        (message "Buffer is not visiting a file!")
      (let ((new-name (read-file-name "New name: " filename)))
        (cond
         ((vc-backend filename) (vc-rename-file filename new-name))
         (t
          (rename-file filename new-name t)
          (set-visited-file-name new-name t t)))))))


(global-set-key (kbd "C-x C-k") #'delete-this-file-and-buffer)
(global-set-key (kbd "C-x C-r") #'rename-this-file-and-buffer)

(setq auto-save-timeout 5)

(defun paredit-barf-all-the-way-backward ()
  (interactive)
  (paredit-split-sexp)
  (paredit-backward-down)
  (paredit-splice-sexp))
(defun paredit-barf-all-the-way-forward ()
  (interactive)
  (paredit-split-sexp)
  (paredit-forward-down)
  (paredit-splice-sexp)
  (if (eolp) (delete-horizontal-space)))
(defun paredit-slurp-all-the-way-backward ()
  (interactive)
  (catch 'done
    (while (not (bobp))
      (save-excursion
        (paredit-backward-up)
        (if (eq (char-before) ?\()
            (throw 'done t)))
      (paredit-backward-slurp-sexp))))
(defun paredit-slurp-all-the-way-forward ()
  (interactive)
  (catch 'done
    (while (not (eobp))
      (save-excursion
        (paredit-forward-up)
        (if (eq (char-after) ?\))
            (throw 'done t)))
      (paredit-forward-slurp-sexp))))

(add-hook! 'emacs-lisp-mode-hook #'paredit-mode)
(add-hook! 'emacs-lisp-mode-hook #'evil-paredit-mode)
(add-hook! 'emacs-lisp-mode-hook #'display-fill-column-indicator-mode)

(after! emacs-lisp
  (define-key emacs-lisp-mode-map (kbd "C-c ^") 'raise-sexp)
  (define-key emacs-lisp-mode-map (kbd "C-c 0") 'paredit-forward-slurp-sexp)
  (define-key emacs-lisp-mode-map (kbd "C-c 9") 'paredit-backward-slurp-sexp)
  (define-key emacs-lisp-mode-map (kbd "C-c ]") 'paredit-forward-barf-sexp)
  (define-key emacs-lisp-mode-map (kbd "C-c [") 'paredit-backward-barf-sexp)

  (define-key emacs-lisp-mode-map (kbd "C-c )") 'paredit-slurp-all-the-way-forward)
  (define-key emacs-lisp-mode-map (kbd "C-c }") 'paredit-barf-all-the-way-forward)
  (define-key emacs-lisp-mode-map (kbd "C-c (") 'paredit-slurp-all-the-way-backward)
  (define-key emacs-lisp-mode-map (kbd "C-c {") 'paredit-barf-all-the-way-backward))

(add-hook! 'scheme-mode-hook #'paredit-mode)
(add-hook! 'scheme-mode-hook #'evil-paredit-mode)
;; display the 80th column.  My code should NOT exceed that.
(add-hook! 'scheme-mode-hook #'display-fill-column-indicator-mode)

(after! scheme
  (define-key scheme-mode-map (kbd "C-c D") #'geiser-edit-symbol-at-point)
  (define-key scheme-mode-map (kbd "C-c ^") 'raise-sexp)
  (define-key scheme-mode-map (kbd "C-c 0") 'paredit-forward-slurp-sexp)
  (define-key scheme-mode-map (kbd "C-c 9") 'paredit-backward-slurp-sexp)
  (define-key scheme-mode-map (kbd "C-c ]") 'paredit-forward-barf-sexp)
  (define-key scheme-mode-map (kbd "C-c [") 'paredit-backward-barf-sexp)

  (define-key scheme-mode-map (kbd "C-c )") 'paredit-slurp-all-the-way-forward)
  (define-key scheme-mode-map (kbd "C-c }") 'paredit-barf-all-the-way-forward)
  (define-key scheme-mode-map (kbd "C-c (") 'paredit-slurp-all-the-way-backward)
  (define-key scheme-mode-map (kbd "C-c {") 'paredit-barf-all-the-way-backward))

;; some of my global key bindings
(global-set-key (kbd "C-c TAB") #'indent-whole-buffer)
;; when point is between two words, delete the space between them
(global-set-key (kbd "C-c \\") #'delete-horizontal-space)
(global-set-key (kbd "C-c SPC") #'just-one-space)
(global-set-key (kbd "C-c $") #'org-archive-subtree)
(with-eval-after-load 'flyspell
  (define-key flyspell-mode-map (kbd "C-c $") nil))
;; some modes my default / in normal mode is NOT bound to helm-swoop, BUT I REALLY LIKE helm-swoop
(global-set-key (kbd "C-c /") #'helm-swoop)
(global-set-key (kbd "C-c C-o") #'org-open-at-point-global)
(global-set-key (kbd "C-c ;") #'comment-dwim)

(global-set-key (kbd "C-c a") 'org-agenda)
(global-set-key (kbd "C-c b") #'(lambda ()
                                  "Switch to the previous buffer"
                                  (interactive)
                                  (switch-to-buffer nil)))
(global-set-key (kbd "C-c B") #'browse-kill-ring)
(global-set-key (kbd "C-c C") #'hydra-org-timer/body)
;;org-capture is SOOO helpful!!
(global-set-key (kbd "C-c c") 'org-capture)
;;open up a new dired window for the current directory
(global-set-key (kbd "C-c d") #'dired-jump)
;; find the current tag smart.  Just know what I mean.
;; For example, with point on the following javascript function upcaseWord
;; var upcase =  upcaseWord (string);
;; And you type C-c D,  ggtags, when open the buffer where that function is defined
;;(global-set-key (kbd "C-c D") 'ggtags-find-tag-dwim)

(global-set-key (kbd "C-c D") #'dumb-jump-go)
(global-set-key (kbd "C-c e") #'helm-M-x)
(global-set-key (kbd "C-c E") #'eshell)
(global-set-key (kbd "C-c f") #'isearch-forward-regexp)
(global-set-key (kbd "C-c F") #'isearch-backward-regexp)
;; open up email mail program

(global-set-key (kbd "C-c h") #'helm-command-prefix)
(global-set-key (kbd "C-c i") #'info-display-manual)
;; type this with point at the end of an elisp expression like
;; (print 5)<point>
;; the result will be 5 printed in the minibuffer
(global-set-key (kbd "C-c l") #'eval-last-sexp)
;;this lets you store an org link from pretty much any file
;;then type C-c C-l in an org buffer and it'll put that link it
(global-set-key (kbd "C-c L") #'org-store-link)
(global-set-key (kbd "C-c I") #'org-insert-link)
(global-set-key (kbd "C-c m") #'helm-mini)

;;print the working directory in the minibuffer
;; I should make these commands copy the output of pwd into the clipboard
(global-set-key (kbd "C-c P") #'pwd)
;;(global-set-key (kbd "C-c p") #'pwd)
;;This does recursive find and replace.  But I think it only works when you are in a dired buffer
(global-set-key (kbd "C-c R") #'find-name-dired)

(after! mu4e
  ;; (setq sendmail-program (executable-find "msmtp")
  ;;       send-mail-function #'smtpmail-send-it
  ;;       message-sendmail-f-is-evil t
  ;;       message-sendmail-extra-arguments '("--read-envelope-from")
  ;;       message-send-mail-function #'message-send-mail-with-sendmail)
  (set-email-account! "jbranso@dismail.de"
                      '((mu4e-sent-folder . "/Sent")
                        (mu4e-drafts-folder . "/Drafts")
                        (mu4e-trash-folder . "/Trash")
                        (smtpmail-smtp-user . "jbranso@dismail.de")
                        (user-mail-address . "jbranso@dismail.de")
                        (mu4e-compose-signature . "---\nYou have greatness within you.\n -Les Brown"))
                      t))

;; EMMS is cool, but the web interface to libre.fm is better.
;; make mpv be the player that plays the songs.  Emacs is not so great with audio.
;;(setq emms-player-list '(emms-player-mpv))
;; set up emms to let me play libre.fm songs.
;;(emms-all)

;; to enable the scrobbler
;;(emms-librefm-scrobbler-enable)
;;Then invoke emms-librefm-stream and enter the URL of the station you wish to listen to, for example “librefm://globaltags/Classical”.

;;; Org customizations

;; org-babel-load-languages and org-export-backends can be commented out
;; when doom emacs' org-mode works again.  For now, I have to use emacs-org.
;; (org-babel-do-load-languages
;;  'org-babel-load-languages
;;  '((emacs-lisp . t)
;;    (shell . t)
;;    (scheme . t)))
;;(setq org-export-backends '(ascii html latex md texinfo odt))
;; If you use `org' and don't want your org files in the default location below,
;; change `org-directory'. It must be set before org loads!
(setq org-directory "~/prog/org/")
(setq org-agenda-include-diary t
      diary-file "~/.doom.d/diary")
(add-hook! 'org-mode-hook 'auto-fill-mode)
(add-hook! 'texinfo-mode-hook 'auto-fill-mode)
(add-hook! 'Texinfo-mode-hook 'auto-fill-mode)
(add-hook! 'texinfo-mode-hook #'display-fill-column-indicator-mode)

;; this bit of code is causing org-mode to NOT work.
;; I used it to generate a letter for Marcin in gtd.org
;; (add-hook 'org-mode-hook
;;           (lambda ()
;;             (add-to-list 'org-latex-classes
;;                          '("letter"
;;                            "\\documentclass{letter}"
;;                            ("\\section{%s}" . "\\section*{%s}")
;;                            ("\\subsection{%s}" . "\\subsection*{%s}")
;;                            ("\\subsubsection{%s}" . "\\subsubsection*{%s}")))))
(after! org
  ;; If I have any other org files that I want to add,
  ;; just add the file's parent directory here.
  (setq org-agenda-files (list org-directory
                               (concat org-directory "projects/")))

  (setq eucharist-head
                   "<nav>
  <a href=\"/\">&lt; Home</a>
</nav>
<div id=\"updated\">Updated: %C</div>")

  (setq eucharist-footer
                   "<footer>
  <div class=\"copyright-container\">
    <div class=\"copyright\">
      Copyright &copy; 2017-2020 Thomas Ingram some rights reserved<br/>
      Content is available under
      <a rel=\"license\" href=\"http://creativecommons.org/licenses/by-sa/4.0/\">
        CC-BY-SA 4.0
      </a> unless otherwise noted
    </div>
    <div class=\"cc-badge\">
      <a rel=\"license\" href=\"http://creativecommons.org/licenses/by-sa/4.0/\">
        <img alt=\"Creative Commons License\"
             src=\"https://i.creativecommons.org/l/by-sa/4.0/88x31.png\" />
      </a>
    </div>
  </div>

  <div class=\"generated\">
    Created with %c on <a href=\"https://www.gnu.org\">GNU</a>/<a href=\"https://www.kernel.org/\">Linux</a>
  </div>
</footer>")

  (setq org-publish-project-alist
        `(
          ("eucharist.org pages" :base-directory "~/prog/org/projects/eucharist/"
           :publishing-directory "~/prog/org/projects/eucharist/site/"
           :html-doctype "html5"
           :html-html5-fancy t
           :html-head "<link rel=\"stylesheet\" href=\"./media/style.css\" type=\"text/css\"/>"
           :with-toc nil
           :section-numbers nil
           :html-preamble ,eucharist-head
           :html-postamble ,eucharist-footer
           :recursive nil)
          ("eucharist.org blog" :base-directory "~/prog/org/projects/eucharist/blog/"
           :publishing-directory "~/prog/org/projects/eucharist/site/blog/"
           :auto-sitemap t
           :sitemap-title "Blog"
           :sitemap-filename "index.org"
           :sitemap-sort-files anti-chronologically
           :html-doctype "html5"
           :html-html5-fancy t
           :html-head "<link rel=\"stylesheet\" href=\"./media/style.css\" type=\"text/css\"/>"
           :with-toc nil
           :section-numbers nil
           :html-preamble ,eucharist-head
           :html-postamble ,eucharist-footer)
          ("eucharist.org media" :base-directory "~/prog/org/projects/eucharist/media"
           :base-extension "css\\|txt\\|jpg\\|gif\\|png"
           :recursive t
           :publishing-directory "~/prog/org/projects/eucharist/site/media"
           :publishing-function org-publish-attachment)
          ("eucharist.org" :components ("eucharist.org pages" "eucharist.org media"
                                        "eucharist.org blog"))))

  ;;(setq org-export-backends '(ascii html latex odt md texinfo))
  (setq my-base-dir  "~/prog/org/projects/"
        my-todo-string "* TODO %?\nEntered on %U\n  %i\n  %a"
        my-someday-string "* %?\nEntered on %U\n  %i\n  %a"
        my-reference-string "* %?\nEntered on %U\n  %i\n  %a"
        org-capture-templates
        `(
          ("B" "Things I want to buy" entry
           (file+headline ,(concat my-base-dir "managing-my-monies.org")
                          "things I want to buy")
           ,my-reference-string)

          ("c" "Computers Anything")

          ;; Emacs things
          ("ce" "Emacs")

          ("ceb" "bugs" entry
           (file+headline ,(concat my-base-dir "become-an-awesome-hacker.org") "Emacs bugs someday")
           ,my-someday-string)

          ("ceb" "evil-mode someday" entry
           (file+headline ,(concat my-base-dir "become-an-awesome-hacker.org") "evil someday")
           ,my-todo-string)

          ("cef" "flycheck someday" entry
           (file+headline ,(concat my-base-dir "become-an-awesome-hacker.org") "flycheck-mode")
           ,my-todo-string)

          ("ceo" "Org-mode someday" entry
           (file+headline ,(concat my-base-dir "become-an-awesome-hacker.org") "org mode someday")
           ,my-someday-string)

          ("ceR" "Emacs Reference")
          ("ceRR" "Emacs Reference" entry
           (file+headline ,(concat my-base-dir "become-an-awesome-hacker.org") "emacs reference")
           ,my-reference-string)
          ("ceRe" "emacs evil reference" entry
           (file+headline ,(concat my-base-dir "become-an-awesome-hacker.org") "evil reference")
           ,my-todo-string)
          ("ceRg" "emacs gnus reference" entry
           (file+headline ,(concat my-base-dir "become-an-awesome-hacker.org") "gnus reference")
           ,my-reference-string)
          ("ceRo" "emacs org reference" entry
           (file+headline ,
            (concat my-base-dir "become-an-awesome-hacker.org") "org reference")
           ,my-reference-string)
          ("ceRm" "emacs magit reference" entry
           (file+headline ,(concat my-base-dir "become-an-awesome-hacker.org") "tags reference")
           ,my-reference-string)
          ("ceRt" "emacs tags reference" entry
           (file+headline ,(concat my-base-dir "become-an-awesome-hacker.org") "tags reference")
           ,my-reference-string)

          ("cet" "emacs Todo")
          ("cett" "emacs Todo" entry
           (file+headline ,(concat my-base-dir "become-an-awesome-hacker.org") "emacs someday")
           ,my-someday-string)
          ("cete" "emacs evil someday" entry
           (file+headline ,(concat my-base-dir "become-an-awesome-hacker.org") "evil someday")
           ,my-someday-string)
          ("cetf" "emacs flycheck someday" entry
           (file+headline ,(concat my-base-dir "become-an-awesome-hacker.org") "flycheck someday")
           ,my-someday-string)
          ("cetg" "emacs gnus someday" entry
           (file+headline ,(concat my-base-dir "become-an-awesome-hacker.org") "gnus someday")
           ,my-someday-string)
          ("ceth" "emacs helm someday" entry
           (file+headline ,(concat my-base-dir "become-an-awesome-hacker.org") "helm someday")
           ,my-someday-string)
          ("ceto" "emacs org someday" entry
           (file+headline ,(concat my-base-dir "become-an-awesome-hacker.org") "org someday")
           ,my-someday-string)
          ("cetT" "emacs tags someday" entry
           (file+headline ,(concat my-base-dir "become-an-awesome-hacker.org") "tags someday")
           ,my-todo-string)
          ("cetw" "web-mode someday" entry
           (file+headline ,(concat my-base-dir "become-an-awesome-hacker.org") "web-mode someday")
           ,my-todo-string)
          ;;End Emacs things

          ("cG" "Gimp Basics Reference" entry
           (file+headline "~/prog/cheatsheets/gimp.org" "Basic Concepts")
           ,my-reference-string)

          ("cg" "Guix someday" entry
           (file+headline  ,(concat my-base-dir "become-an-awesome-hacker.org") "Guix someday")
           ,my-someday-string)

          ("cH" "The GNU HURD")
          ("cHt" "Hurd" entry
           (file+headline ,(concat my-base-dir "become-an-awesome-hacker.org")
                          "Hurd")
           ,my-someday-string)
          ("ct" "General Computer TODO"
           entry
           (file+headline ,(concat my-base-dir "become-an-awesome-hacker.org") "General TODO")
           ,my-someday-string)
          ("ch" "high star todo"
           entry
           (file+headline ,(concat my-base-dir "become-an-awesome-hacker.org") "make high star an android app")
           "* todo %?\n  %i\n  %a")
          ("cl" "linux TODO" entry
           (file+headline ,(concat my-base-dir "become-an-awesome-hacker.org") "linux someday")
           ,my-someday-string)
          ("cL" "Linux Reference" entry
           (file+headline ,(concat my-base-dir "become-an-awesome-hacker.org") "linux reference")
           ,my-reference-string)
          ("co" "organ TODO" entry
           (file+headline ,(concat my-base-dir "become-an-awesome-hacker.org") "make organ an android app")
           ,my-someday-string)
          ("cf" "Free the world" entry
           (file+headline "~/prog/org/gtd.org" "free the world free content")
           ,my-reference-string)

          ("cW" "Web")

          ("cWB" "Bootstrap Reference" entry
           (file+headline ,(concat my-base-dir "become-an-awesome-hacker.org") "Bootstrap reference")
           ,my-reference-string)

          ("cWW" "Web reference" entry
           (file+headline ,(concat my-base-dir "become-an-awesome-hacker.org") "Web reference")
           ,my-reference-string)

          ;; make a HTML reference or CSS reference

          ("C" "Community")
          ("Cc" "community TODO" entry
           (file+headline ,(concat my-base-dir "being-social.org") "community someday")
           ,my-someday-string)

          ("Cn" "nice things to say" entry
           (file+headline "~/prog/org/projects/get-close-to-God.org" "nice things to say")
           ,my-someday-string)
          ("Cs" "Social Skills Notes" entry
           (file+headline ,(concat my-base-dir "being-social.org") "Social Skills Notes")
           ,my-reference-string)

          ("A" "Calendar TODO" entry
           (file+headline "~/prog/org/gtd.org" "Calendar")
           ,my-todo-string)

          ("e" "entertainment")
          ("eb" "Books to Read" entry
           (file+headline ,(concat my-base-dir "whatever-I-want.org")
                          "Books to Read") "*  %i\n  %a")
          ("eM" "Good Movies Reference" entry
           (file+headline ,(concat my-base-dir  "whatever-I-want.org") "Good Movies") "*  %i\n  %a")
          ("em" "movies to watch" entry
           (file+headline ,(concat my-base-dir "whatever-I-want.org") "movies to watch") "*  %i\n  %a")
          ("eU" "good music reference" entry
           (file+headline ,(concat my-base-dir "whatever-I-want.org")
                          "good music reference") "*  %i\n  %a")
          ("eg" "games to play" entry
           (file+headline ,(concat my-base-dir "whatever-I-want.org")
                          "games to play") "*  %i\n  %a")

          ("g" "getting close to God")
          ("gg" "get a close friend" entry
           (file+headline "/home/joshua/prog/org/projects/get-close-to-God.org"
                          "get a close friend") ,my-someday-string)
          ("gb" "Boundaries")
          ("gbn" "Boundary Notes" entry
           (file+headline "~/prog/org/gtd.org" "Boundary Notes")
           ,my-reference-string)
          ("gbl" "Lowering My Expectations of Myself" entry
           (file+headline "~/prog/org/gtd.org"
                          "Lowering My Expectations of Myself")
           ,my-reference-string)
          ("gbs" "Boundaries To Enforce" entry
           (file+headline "~/prog/org/projects/get-close-to-God.org" "Setting Boundaries")
           ,my-someday-string)


          ("M" "Math")
          ("Mf" "fun math problems" entry
           (file+headline "/home/joshua/prog/org/projects/math.org" "fun math problems") ,my-someday-string)
          ("p" "payless TODO" entry
           (file+headline "~/prog/org/gtd.org" "shopping todo")
           ,my-someday-string)
          ("r" "Reference" entry
           (file+headline "~/prog/org/gtd.org" "general reference")
           ,my-reference-string)
          ("t" "TODO" entry
           (file+headline "~/prog/org/gtd.org" "general todo")
           ,my-todo-string)
          ("w" "Weblink" entry
           (file (expand-file-name "~/prog/org/gtd.org" "org capture"))
           "* %c\n  :PROPERTIES:\n  :CREATED: %U\n  :END:\n  - Quote:\n    %i" :unnarrowed)

          ("q" "Quotations" entry
           (file+headline "~/prog/org/quotes.org" "Quotations")
           ,my-reference-string)
          ))
  (setq org-startup-folded t))

;; This determines the style of line numbers in effect. If set to `nil', line
;; numbers are disabled. For relative line numbers, set this to `relative'.
(setq display-line-numbers-type t)

;; irc stuff.
;; M-x irc to use rcirc, which is more lightweight.
;; Change user info
;;(setq rcirc-default-nick "gnucode")
;;(setq rcirc-default-user-name "jab")
;;(setq rcirc-default-full-name "Joshua Branson")
;;
;;(setq rcirc-server-alist
;;      '(("irc.libera.chat" :port 6697 :encryption tls
;;	 :channels ("#openbsd" "#emacs" "#hurd #guix"))))

(setq projectile-project-search-path '("~/prog/"))
(after! projectile
  (setq projectile-project-root-files-bottom-up
        (remove ".git" projectile-project-root-files-bottom-up)))
;; hide join/quit messages in irc
;; circe by default shows you which channels have new messages.
;; I would prefer it to only show channels where someone has sent me a message.
(after! circe
  (set-company-backend! 'circe-mode nil)
  (setq circe-reduce-lurker-spam t)
  (set-irc-server! "irc.libera.chat"
    `(:tls t
      :port 6697
      :nick "gnucode"
      :sasl-username "jab"
      :sasl-password "babbages"
      :channels ("#hurd" "#emacs" "#guix" "#openbsd" "#whereiseveryone"))))

;; FIX this so it works.  I still get messages for anyone who talks in the rooms,
;; which is kind of annoying.
;; (after! erc
;;   (setq erc-autojoin-channels-alist '(
;;                                       ;;("freenode.net" "#archlinux")
;;                                       ;;("ircs://irc.oftc.net:6697" "#awesome")
;;                                       ;;("freenode.net" "#deskthority")
;;                                       ;;("freenode.net" "#erc")
;;                                       ("libera.chat" "#emacs")
;;                                       ;;("libera.chat" "#fsf")
;;                                       ;;("libera.chat" "#gnupg")
;;                                       ("libera.chat" "#gnus")
;;                                       ("libera.chat" "#guix")
;;                                       ("libera.chat" "#guile")
;;                                       ("libera.chat" "#hurd")
;;                                       ("libera.chat" "#org-mode")
;;                                       ;;("libera.chat" "#openhatch")
;;                                       ("libera.chat" "#nginx")
;;                                       ;;regular meeting take place every thursday at 19:00 UTC
;;                                       ;; get questions answered about building your own keyboard
;;                                       ;; https://www.parabola.nu/
;;                                       ;;("libera.chat" "#parabola")
;;                                       ;;purdue users group
;;                                       ;;("libera.chat" "#purduelug")
;;                                       ("libera.chat" "#wordpress")
;;                                       ;;("libera.chat" "#znc")
;;                                       ;;("libera.chat" "#debian-hurd")
;;                                       ("irc.w3.org" "#social") ; Chris web's social incubator group for activity pub
;;                                       )

;;         ;; Rename server buffers to reflect the current network name instead
;;         ;; of SERVER:PORT. (e.g. "freenode" instead of "irc.freenode.net:6667"). This
;;         ;; is useful when using a bouncer like ZNC where you have multiple
;;         ;; connections to the same server.
;;         erc-rename-buffers t
;;         ;; set the default nick
;;         erc-nick "gnucode"
;;         ;;erc-prompt-for-password t
;;         erc-hide-list '("JOIN" "PART" "QUIT")
;;         ;; don't let erc switch the active buffer when it connects to a new channel when erc is starting up
;;         ;; this gets annoying because when I'm starting up emacs, it'll switch to "#arch", then "#hurd", then "#org-mode".
;;         ;; it's very weird.  But after erc has loaded and those initial buffers come up, I want erc to jump to a new channel
;;         ;; when I try to join it
;;         erc-join-buffer 'bury
;;         erc-port 6697

;;         ;; Interpret mIRC-style color commands in IRC chats
;;         erc-interpret-mirc-color t)

;;   (defun my/connect-to-erc ()
;;     (interactive)
;;     (erc-tls :server "irc.libera.chat" :port "6697"
;;              :nick "jab")))

(setq flycheck-global-modes (list 'scheme-mode 'emacs-lisp-mode))

;; Here are some additional functions/macros that could help you configure Doom:
;;
;; - `load!' for loading external *.el files relative to this one
;; - `use-package!' for configuring packages
;; - `after!' for running code after a package has loaded
;; - `add-load-path!' for adding directories to the `load-path', relative to
;;   this file. Emacs searches the `load-path' when you load packages with
;;   `require' or `use-package'.
;; - `map!' for binding new keys
;;
;; To get information about any of these functions/macros, move the cursor over
;; the highlighted symbol at press 'K' (non-evil users must press 'C-c c k').
;; This will open documentation for it, including demos of how they are used.
;;
;; You can also try 'gd' (or 'C-c c d') to jump to their definition and see how
;; they are implemented.
